package com.cyd.demo3.controller;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @Name : com.cyd.demo3.controller.TwoServlet
 * @Description : 描述
 * Created by cyd on 2021-05-13 11:26:41
 */
@WebServlet(name = "twoServlet", value = "/two")
public class TwoServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.setCharacterEncoding("UTF-8");

        resp.setCharacterEncoding("UTF-8");
        resp.setContentType("text/html");
        System.out.println("two: 负责洗韭菜");
        PrintWriter out = resp.getWriter();
        out.print("<h2>two: 负责洗韭菜</h2>");
//        resp.sendRedirect("http://localhost:8080/demo3/three");
        resp.sendRedirect("/demo3/three");
    }
}
